/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tpgrandt;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import tpgrandt.UI.Principal;
import tpgrandt.UI.PrincipalAdministrador;
import tpgrandt.UI.PrincipalPeriodista;
import tpgrandt.UI.PrincipalParticipante;
import tpgrandt.control.Administrador;
import tpgrandt.control.GestionParticipante;
import tpgrandt.control.Periodista;

/**
 *
 * @author nacho
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
		try
		{
		   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch (Exception e)
		{
		   e.printStackTrace();
		}
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
		new Principal().setVisible(true);
		/*
		 *
		 *
                BufferedReader bri = null;
                BufferedWriter bro = null;
                try {
                    File fi = new File("./src/Recursos/fixtureGrandt.txt");
                    File fo = new File("./src/Recursos/fixtureSQL.txt");
                    bri = new BufferedReader(new FileReader(fi));
                    bro = new BufferedWriter(new FileWriter(fo));
                    String linea = bri.readLine();
                    int fecha = 0;
                    while (linea != null) {
                        if (linea.equals("-")) {
                            linea = bri.readLine().trim();
			    fecha = Integer.parseInt(linea);
                            String query = "INSERT INTO fecha (fecha, cerrada) " +
                                    "VALUES (" + fecha + ", 0);\n";
                            bro.write(query);
                            linea = bri.readLine();
                        }

                        char l[] = linea.toCharArray();
                        int i = 0;
                        String local = "";
                        String visitante = "";

                        for (;l[i] != '\t'; i++)
                            local += l[i];
                        i += 1;

                        for (;i < l.length; i++)
                            visitante += l[i];

                        String query = "INSERT INTO partido (fecha, local, visitante) " +
                                "VALUES (" + fecha + ", " + local + ", " +
                                visitante + ");\n";
                        bro.write(query);
                        linea = bri.readLine();
                    }
                } catch (FileNotFoundException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IOException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                } finally {
                    try {
                        bri.close();
                        bro.close();
                    } catch (IOException ex) {
                        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
		 *
		 *
		 */
            }
        });
    }

}
